/*!
 * Copyright (C) 2020 - All Rights Reserved by
 * @author : ZhaoYanbo
 * @email  : zyb920@hotmail.com
 * @created: 2020-10-31
 * @version: 1.0.0.0
 *
 */

#ifndef CMODELMANAGER_H
#define CMODELMANAGER_H

#include <QObject>

class CScan;
class CImgProvider;
class ThumbDataModel;
class QQmlApplicationEngine;

class CModelManager : public QObject
{
    Q_OBJECT
public:
    explicit CModelManager(QObject *parent = nullptr);
    ~CModelManager();

    /*!
     * \brief 注册QML中需要使用的模型
     * \param engine: QML引擎
     */
    void registFuncManager(QQmlApplicationEngine *engine);

    /*!
     * \brief 扫描指定路径
     * \param path: 为空时,扫描全磁盘。否则扫描指定路径
     */
    Q_INVOKABLE void scan(const QString &path = "");

    Q_INVOKABLE ThumbDataModel *dataModel() const;

    Q_INVOKABLE void copy(int index);

private:
    void doScanFinished();

private:
    CScan *m_pScan = nullptr;
    CImgProvider *m_pImgProvider = nullptr;
    ThumbDataModel *m_pThumbDataModel = nullptr;
};

#endif // CMODELMANAGER_H
